import request from 'utils/request';

//获取文章列表
export const getArticlesApi = (params) => {
  return request({
    url: '/v1_0/mp/articles',
    params,
  });
};
//删除文章
export const delArticleApi = (id) => {
  return request({
    url: '/v1_0/mp/articles/' + id,
    method: 'delete',
  });
};
//新增
export const addArticleApi = (data) => {
  return request({
    url: '/v1_0/mp/articles?draft=' + data.draft,
    method: 'post',
    data,
  });
};
//获取文章详情
export const getArticleDetailApi = (id) => {
  return request({
    url: '/v1_0/mp/articles/' + id,
  });
};
//编辑
export const editArticleApi = (data) => {
  return request({
    url: `/v1_0/mp/articles/${data.id}?draft=${data.draft}`,
    method: 'put',
    data,
  });
};
